package mygame;

import mygame.Backbone.ICam;
import mygame.Backbone.PlanetCam;
import mygame.GUI.GUIManager;
import mygame.Input.InputHandler;

import com.jme3.app.SimpleApplication;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.queue.RenderQueue.ShadowMode;

/**
 * test
 * @author normenhansen
 */
public class Main extends SimpleApplication {
	
    public static void main(String[] args) {
        Main app = new Main();
        app.start();
    }
    @Override
    public void simpleInitApp() {
    	rootNode.setShadowMode(ShadowMode.Off);
        //Register all inputs
    	getCamera().setFrustumPerspective(45f, (float) getCamera().getWidth() / getCamera().getHeight(), 0.5f, 1000f);
        InputHandler iph = new InputHandler(inputManager);
        GUIManager guim = new GUIManager(guiNode, assetManager, inputManager, audioRenderer,guiViewPort);
        //add CameraController
        //ICam cam = new MyCamera(getCamera(), inputManager);  
        
        Manager.MakeInstance(rootNode, stateManager, assetManager, getCamera(), guiNode, settings,iph,viewPort,guim);
        Manager.GetInstance().init();
    }

    @Override
    public void simpleUpdate(float tpf) {
        if (!Manager.GetInstance().isRunning()) {
            stop();
        }
        Manager.GetInstance().update(tpf);
    }

    @Override
    public void simpleRender(RenderManager rm) {
        //TODO: add render code
    }

    @Override
    public void stop() {
        Manager.GetInstance().getSavingHandler().save();
        super.stop(); // continue quitting the game
    }
}
